package com.oppo.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.oppo.tools.MyTools;

@WebServlet("/GetPayInfoAction")
public class GetPayInfoAction extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		request.getSession().getAttribute("car_ids");
		String info =MyTools.dateToString(new Date(), "yyyyMMddHHMMssSSS");
		
		String totalprice = request.getSession().getAttribute("totalprice").toString();
		String detail = "OPPO手机商城购买手机消费";
		
		List<String> list = new ArrayList<>();
		list.add(info);
		list.add(totalprice);
		list.add(detail);
		String strJson = JSON.toJSONString(list);// 借用第三方工具将list集合转换为json字符串
		PrintWriter pw = response.getWriter();//响应客户端的请求
		pw.write(strJson);//将字符串发送给客户端
		pw.flush();
		pw.close();
	}

}
